package com.ruoyi.marketing.service.impl;

import java.util.List;

import com.ruoyi.marketing.domain.MarketingActivity;
import com.ruoyi.marketing.domain.MarketingAward;
import com.ruoyi.marketing.service.IMarketingActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.marketing.mapper.AwardPageMapper;
import com.ruoyi.marketing.domain.AwardPage;
import com.ruoyi.marketing.service.IAwardPageService;

/**
 * 营销活动列表Service业务层处理
 *
 * @author hao
 * @date 2023-01-31
 */
@Service
public class AwardPageServiceImpl extends ServiceImpl<AwardPageMapper, AwardPage> implements IAwardPageService {
    @Autowired
    private IMarketingActivityService marketingActivityService;

    /**
     * 查询营销活动列表列表
     *
     * @param awardPage 营销活动列表
     * @return 营销活动列表
     */
    @Override
    public List<AwardPage> selectAwardPageList(AwardPage awardPage) {
        List<AwardPage> awardPages = getBaseMapper().selectAwardPageList(awardPage);
        for (AwardPage page : awardPages) {
            MarketingActivity byId = marketingActivityService.getById(page.getActivityId());
            if (byId != null) {
                page.setMarketingActivity(byId);
            }
        }
        return awardPages;
    }
}
